package com.bw.base.net.net

import com.blankj.utilcode.util.SPUtils
import okhttp3.Interceptor
import okhttp3.Response

class TokenInterceptor:Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val token=SPUtils.getInstance().getString(Cons.SP_TOKEN)
        val newBuilder=chain.request().newBuilder()
        if (token!=null){
            newBuilder.addHeader(Cons.PARAM_TOKEN,token)
        }
        return chain.proceed(newBuilder.build())
    }
}